-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
modpi - initial revision #4799
modpi - initial revision #4799
Conversation
…tants. for modpi(Int64), we check that the argument converts to a float64 losslessly, and throw an error otherwise.
We could be really clever here, and make |
@simonbyrne: that's already in here :-) |
Ok, I think I've incorporated all your comments, and added a test file (and added that to runtests.jl). Anything else? |
This is extremely impressive --- that level of testing is amazing. I dislike doing this by calling I'm not sure if we need to list these functions under "division functions" in the manual, but I guess it's ok. However help entries in |
Oh, this continuous integration testing is pretty cool! |
@JeffBezanson - thanks, and very good point. My Julia was broken for a bit when I transitioned to OS 10.9, so I did the testing against WolframAlpha in python and then copied and pasted over, that's why there's all this text parsing stuff. I'll refactor it. As for documentation, I just searched for "mod" and added them there. But happy to put elsewhere, let me see where they'd fit in in base.rst. |
@staticfloat is to be thanked for our CI. Since The notebook is really nice. I'll probably steal stuff from it for presentations! (Cc: @alanedelman) |
Looking through the commit source, this is indeed calling openlibm. |
@StefanKarpinski Ah, I missed that, very nice work @fabianlischka. Probably should document the behaviour though, so users aren't confused when |
Users will be confused by floating point behaviour anyway. If you change We should teach users to not use |
To dispatch on the MathConstant type for pi (by type, without runtime penalty) is very nice, but I am ambiguous about it, for these reasons:
Note that these anomalies go somewhat beyond the usual floating point issues. I am wondering whether alternatively: What do you think? |
I agree that it does feel a bit fishy. I keep wanting to extend the MathConst thing further, but that road can rapidly lead to insanity. One thing we could do is include an integer coefficient in MathConsts so that |
I agree; at least for now let's not make this part of any other function.
|
So, just to confirm, I'll remove these lines for now, right? mod(x::Float64, y::MathConst{:π}) = modpi(x) |
Yes. |
I've added modpi etc. documentation to both I'm not aware of anything missing now, so I think you can pull (assuming the help files are ok) |
BTW, no need to modify the make file, right? (I notice that andrioni made a few changes to the makefile when exposing the floating point rounding flags) |
I believe |
oops... seems I segfaulted the gcc build. Was that a fluke, or is there a problem with the last commit? Can anyone have a look? How can I re-run it? Segmentation fault
*** This error is usually fixed by running 'make clean'. If the error persists, try 'make cleanall'. ***
make[2]: *** [/home/travis/build/JuliaLang/julia/usr/lib/julia/sys.ji] Error 1
make[1]: *** [debug] Error 2
make: *** [install] Error 2 |
It's probably not your fault. I've restarted that build. |
Bummer, I forgot modpau. |
to fix #2524
see here for an overview and testing: http://nbviewer.ipython.org/7443293